package com.theatre.userservice.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.theatre.userservice.model.entity.RoleFunction;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleFunctionMapper extends BaseMapper<RoleFunction> {
    /**
     * 根据角色ID查询所有权限的名称
     * @param roleId 角色ID
     * @return 权限名称列表
     */
    @Select("SELECT f.permission_code " +
            "FROM functions f " +
            "JOIN role_functions rf ON f.id = rf.function_id " +
            "WHERE rf.role_id = #{roleId}")
    List<String> selectPermissionsByRoleId(Long roleId);
}
